package com.project.api.common.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {
    @Bean
    public FilterRegistrationBean filterRegistration() {
        //新建过滤器注册类
        FilterRegistrationBean registration = new FilterRegistrationBean();
        // 添加我们写好的过滤器
        registration.setFilter(new Filter());
        // 设置过滤器的URL模式
        registration.addUrlPatterns("/verify/*");
//        registration.addUrlPatterns("/*");
        registration.setOrder(0);
        return registration;
    }
//    @Bean
//    public FilterRegistrationBean filterRegistrationParent() {
////    新建过滤器注册类
//        FilterRegistrationBean registration = new FilterRegistrationBean();
////     添加我们写好的过滤器
//        registration.setFilter(new ParentFilter());
////     设置过滤器的URL模式
//        registration.addUrlPatterns("/*");
//        registration.setOrder(Integer.MAX_VALUE - 1);
//        return registration;
//    }
}
